﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SlimDX;
using SlimDX.Direct3D10;

namespace EikonLeap
{
    public class Camera
    {
        public Camera()
        {
            m_eye = new Vector3(0.0f, 0.0f, 1.0f);
            m_at = new Vector3(0.0f, 0.0f, 0.0f);
            m_up = new Vector3(0.0f, 1.0f, 0.0f);
            ComputeViewTransforms();    
        }

        public bool IsActive { get; set; }
        public Vector3 Eye 
        {
            get
            {
                return m_eye;
            }

            set
            {
                m_eye = value;
                ComputeViewTransforms();
            }
        }
        private Vector3 m_eye, m_at, m_up;

        private void ComputeViewTransforms()
        {
            ViewTransform = Matrix.LookAtRH(m_eye, m_at, m_up);
        }

        public Vector3 At 
        {
            get
            {
                return m_at;
            }
            set
            {
                m_at = value;
                ComputeViewTransforms();
            }
        }

        public Vector3 Up 
        {
            get
            {
                return m_up;
            }
            set
            {
                m_up = value;
                ComputeViewTransforms();
            }
        }

        public Matrix ViewTransform { get; set; }
    }
}
